﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="business_settlement.aspx.cs" Inherits="SF.Ucenter.admin.finance.business_settlement" %>

<%@ Import Namespace="SF.Common" %>

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,initial-scale=1.0,user-scalable=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <title>商户结算列表</title>
    <link href="../../scripts/artdialog/ui-dialog.css" rel="stylesheet" type="text/css" />
    <link href="../skin/default/style.css" rel="stylesheet" type="text/css" />
    <link href="../../css/pagination.css" rel="stylesheet" type="text/css" />
    <link href="../../css/validate.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../../scripts/jquery/jquery-1.11.2.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="../../scripts/datepicker/WdatePicker.js"></script>
    <script type="text/javascript" src="../../scripts/artdialog/dialog-plus-min.js"></script>
    <script type="text/javascript" charset="utf-8" src="../js/laymain.js"></script>
    <script type="text/javascript" charset="utf-8" src="../js/common.js"></script>
    <style type="text/css">
        .date-input {
            width:130px;
        }
    </style>
    <script type="text/javascript">
        //财务结算打印订单
        function settlePrint(settleNum) {
            var winDialog = top.dialog({
                title: '打印订单',
                url: 'finance/settlement_dialog_print.aspx?settleNum=<%=settleNum %>',
                width: 850
            }).showModal();
        }

        //商户打印订单
        function businessPrint(id) {
            var winDialog = top.dialog({
                title: '打印订单',
                url: 'finance/business_dialog_print.aspx?id='+id,
                width: 850
            }).showModal();
        }

        function sendMessage(singleNum) {
            var nums = "";
            if (singleNum.length == 0) {
                if ($("input:checked").length == 0) {
                    var winDialog = top.dialog({
                        title: '提示',
                        content: "请从列表中选择商户！",
                        okValue: '确定',
                        ok: function () { }
                    }).showModal();
                    return;
                }

                $("input:checked").each(function (i) {
                    nums += $(this).parent().attr("data") + ",";
                });

            } else {
                nums = singleNum;
            }

            $.ajax({
                url: "business_settlement.aspx",
                type: "get",
                cache: false,
                data: { action: 'GetBusinessUserNames', businessNums: nums },
                success: function (data) {
                    var obj = eval("(" + data + ")");
                    $("#send_user_names").val(obj.userNames);
                    $("#send_user_real_names").val(obj.userRealNames);
                    form0.submit();
                },
                complete: function () { },
                error: function () { }
            }); 
        }
    </script>
</head>

<body class="mainbody">
    <form id="form0" target="_self" action="../manager/message_edit.aspx" >
        <input id="action" name="action" type="hidden" value="sendMessage" />
        <input id="send_user_real_names" name="send_user_real_names" type="hidden" value="" />
        <input id="send_user_names" name="send_user_names" type="hidden" value="" />
    </form>
    <form id="form1" runat="server">
        <asp:HiddenField ID="hdsettlenum" Value="" runat="server" />
        <!--导航栏-->
        <div class="location">
            <a href="javascript:history.back(-1);" class="back"><i></i><span>返回上一页</span></a>
            <a href="../center.aspx" class="home"><i></i><span>首页</span></a>
            <i class="arrow"></i>
            <a href="finance_settlement_past.aspx" class="home"><span>财务结算记录</span></a>
            <i class="arrow"></i>
            <span>商户结算记录</span>
        </div>
        <!--/导航栏--> 
        <!--工具栏-->
        <div id="floatHead" class="toolbar-wrap">
            <div class="toolbar">
                <div class="box-wrap">
                    <a class="menu-btn"></a>
                    <table>
                        <tr>
                            <td valign="top">
                                <div class="rule-single-select">
                                    <asp:DropDownList ID="ddlStatus" runat="server" AutoPostBack="True" onselectedindexchanged="ddlStatus_SelectedIndexChanged">
                                      <asp:ListItem Value="-1" Selected="True">所有商户</asp:ListItem>
                                      <asp:ListItem Value="0">欠费商户</asp:ListItem>
                                      <asp:ListItem Value="1">已收费商户</asp:ListItem>
                                    </asp:DropDownList>
                                </div>
                            </td>
                            <td>
                                <div class="l-list">
                                    <ul class="icon-list">
                                        <li><a class="all" href="javascript:;" onclick="checkAll(this);"><i></i><span>全选</span></a></li>
                                        <li><a class="all" href="javascript:sendMessage('');"><i></i><span>发送通知</span></a></li>
                                        <li><a class="move" target="_blank" href="business_settlement.aspx?action=export&settleNum=<%=settleNum %>&state=<%=state %>&keywords=<%=keywords %>"><i></i><span>导出</span></a></li>
                                        <li><a class="move" href="javascript:settlePrint();"><i></i><span>打印</span></a></li>
                                    </ul>
                                </div>
                            </td>
                        </tr>
                    </table>
                    

                    <div class="r-list">                        
                        <asp:TextBox ID="txtKeywords" runat="server" CssClass="keyword" />
                        <asp:LinkButton ID="lbtnSearch" runat="server" CssClass="btn-search" onclick="btnSearch_Click" >查询</asp:LinkButton> 
                    </div>
                </div>
            </div>
        </div>
        <!--/工具栏--> 


        <!--列表-->
        <div class="table-container">        
            <table style="width:100%; margin-bottom:10px;">
                <tr style="width:100%;">
                    <td style="width:30%;font-size:12px;" align="left">
                        结算单编号&nbsp;&nbsp;:&nbsp;&nbsp;
                        <asp:Label ID="lbsettlement_num" style="border-bottom:1px solid black;" Width="135px" runat="server"></asp:Label>
                    </td>
                    <td style="width:33%;font-size:12px;" align="center">
                        经手人&nbsp;&nbsp;:&nbsp;&nbsp;
                        <asp:Label ID="lboperator"  style="border-bottom:1px solid black;"  Width="80px" runat="server"></asp:Label>
                    </td>
                    <td style="width:33%;font-size:12px;" align="right">
                        生成时间&nbsp;&nbsp;:&nbsp;&nbsp;
                        <asp:Label ID="lbcreate_time"  style="border-bottom:1px solid black;"  Width="120px" runat="server"></asp:Label>
                    </td>
                </tr>
            </table>
            <asp:Repeater ID="rptList" runat="server">
                <HeaderTemplate>
                <table width="100%" border="0" cellspacing="0" cellpadding="0" class="ltable">
                    <tr>    
                        <th width="6%">选择</th>                   
                        <th align="left" width="16%">商户编号</th>
                        <th align="left"  width="16%">商户名称</th>
                        <th align="left"  width="13%">结算金额(元)</th>
                        <th align="left"  width="15%">生成时间</th>
                        <th align="left"  width="8%">状态</th>
                        <th width="12%">操作</th>
                    </tr>
                    <tbody class="ltbody">

                </HeaderTemplate>
                <ItemTemplate>
                    <tr>           
                    <td align="center">
                        <asp:CheckBox ID="chkId" CssClass="checkall" data='<%#Eval("busnieseNum")%>' runat="server" style="vertical-align:middle;" />
                        <asp:HiddenField ID="HiddenField1" Value='<%#Eval("busnieseNum")%>' runat="server" />
                    </td>
                    <td align="left">
                        <%#Eval("busnieseNum")%>
                    </td>
                    <td align="left">
                        <%#Eval("businessName")%>
                    </td>
                    <td align="left">
                        <%#Eval("total_amount")%>
                    </td>
                    <td align="left">
                        <%#Eval("create_time")%> 
                    </td>
                    <td align="left">
                        <i title="<%# Eval("state").ToString() == "1" ?"已完成收费":"未完成收费" %>" class="<%# Eval("state").ToString() == "1" ?"Validform_right":"Validform_wrong" %>"></i> 
                    </td>
                    <td align="center">
                        <a href="businessapp_settlement.aspx?id=<%#Eval("id")%>">查看</a>
                        |&nbsp;<a href="javascript:businessPrint(<%#Eval("id")%>)">打印</a>
                        |&nbsp;<a href="<%# "javascript:sendMessage('"+Eval("busnieseNum")+"')"%>">发送通知</a>
                    </td>
                </tr>

                </ItemTemplate>
                <FooterTemplate>
                        <%#rptList.Items.Count == 0 ? "<tr><td align=\"center\" colspan=\"7\">暂无记录</td></tr>" : ""%>
                    </tbody>
                    </table>
                </FooterTemplate>
            </asp:Repeater>            
        </div>
        <!--/列表-->

        <!--内容底部-->
        <div class="line10"></div>
        <table style="width:100%;">
            <tr style="width:100%;">
                <td style="width:65%;" align="left">
                    <div class="pagelist" style="margin-top:10px;">
                        <div class="l-btns">
                            <span>显示</span><asp:TextBox ID="txtPageNum" runat="server" CssClass="pagenum" onkeydown="return checkNumber(event);"
                                OnTextChanged="txtPageNum_TextChanged" AutoPostBack="True"></asp:TextBox><span>条/页</span>
                        </div>
                        <div id="PageContent" runat="server" class="default"></div>
                    </div>
                </td>
                <td style="width:auto;font-size:12px; padding-top:10px;" align="right" valign="top">
                    <table>
                        <tr>
                            <td>
                                合计:
                            </td>
                            <td align="center">
                                <asp:Label ID="lbtotal"  style="border-bottom:1px solid black;color:blue;" runat="server" Width="70px" ></asp:Label>(元)
                            </td>
                            <td>已收:</td>
                            <td align="center">
                                <asp:Label ID="lbreceived"  style="border-bottom:1px solid black;color:green;" Width="70px" runat="server" ></asp:Label>(元)
                            </td>
                            <td>未收:</td>
                            <td align="center">
                                <asp:Label ID="lbnot_received"  style="border-bottom:1px solid black;color:red;"  Width="70px" runat="server" ></asp:Label>(元)
                            </td>
                        </tr>
                    </table>

                </td>
            </tr>
        </table>
        <!--/内容底部-->
    </form>
</body>
</html>